{include file="public/header296" /}
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list">
  <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-inline">
      <input type="text" lay-verify="required" name="name" autocomplete="on" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">顶级分类</label>
    <div class="layui-input-inline">
      <select name="top_id" lay-filter="top_id" lay-verify="required">
        <option value="0">顶级分类</option>
          {volist name="category_list" id="item"}
          <option value="{$item.id}">{$item.name}</option>
          {/volist}
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">岗位分类</label>
    <div class="layui-input-block" id="parent_id">
      <input type="radio" name="parent_id" />
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">排序id</label>
    <div class="layui-input-inline">
      <input type="text" name="sort" value="{:sort_id('job_category')}" class="layui-input" />
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">岗位级别</label>
    <div class="layui-input-block">
      <input type="radio" name="level" value="1" title="一级" />
      <input type="radio" name="level" value="2" title="二级" />
      <input type="radio" name="level" value="3" title="三级" />
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">热招岗位</label>
    <div class="layui-input-inline">
      <input type="checkbox" name="is_hot" lay-skin="switch" lay-filter="switchHot" lay-text="热门|非热门" checked />
    </div>
  </div>
  <div class="layui-form-item layui-hide">
    <input type="button" lay-submit lay-filter="Lay-app-form-submit" id="Lay-app-form-submit" value="添加">
  </div>
</div>
<script>
  layui.use(['layer','form'], function(){
    var $ = layui.$
            , form = layui.form;

  // 获取主栏目下的子栏目
  form.on('select(top_id)', function(obj){
    //var top_id = $("select").val();
    var top_id =  obj.value
    $.ajax({
      url:"{:url('job/getJobCategory')}",
      type: "POST",
      dataType: "JSON",
      data: {top_id: top_id},
      success:function(data){
        var proHtml = '';
        for(var o in data){
          proHtml += '<input type="radio" name="parent_id" value="' + data[o].id +  '" title="'+ data[o].name +'">';
        }
        $('#parent_id').html(proHtml);
        form.render();
      },
      error:function(){
        alert("error");
      }
    })
  });
})
</script>
{include file="public/footer" /}